<?php /*a:2:{s:51:"F:\CaOadmin\application\admin\view\index\login.html";i:1569222580;s:37:"../application/admin/view/layout.html";i:1569485205;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title><?php echo htmlentities($title); ?></title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico">
    <link href="<?php echo staticResource('css/bootstrap.min.css?v=3.3.6'); ?>" rel="stylesheet">
    <link href="<?php echo staticResource('css/font-awesome.min.css?v=4.4.0'); ?>" rel="stylesheet">
    


    <link href="<?php echo staticResource('css/animate.css'); ?>" rel="stylesheet">
    <link href="<?php echo staticResource('css/style.css?v=4.1.0'); ?>" rel="stylesheet">
    <link href="<?php echo staticResource('extend/common.css'); ?>" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>
            <h1 class="logo-name">H+</h1>
        </div>
        <h3>欢迎使用<?php echo htmlentities($project_name); ?>后台管理系统</h3>

        <form class="m-t" role="form" action="index.html">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="用户名" id="login_name">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="密码" id="pwd">
            </div>
            <div class="form-group" style="position: relative;height: 34px;">
                <input type="text" class="form-control" placeholder="验证码" id="captcha" style="width: 62%; position: absolute">
                <img src="<?php echo url('admin/captcha'); ?>" alt="验证码" id="cap-img" onclick="getCaptcha()" style="height: 34px; position: absolute;right: 0;cursor: pointer;">
            </div>
            <button type="button" class="btn btn-primary block full-width m-b" onclick="login()">登 录</button>
            </p>
        </form>
    </div>
</div>


<!-- 全局js -->
<script src="<?php echo staticResource('js/jquery.min.js?v=2.1.4'); ?>"></script>
<script src="<?php echo staticResource('js/bootstrap.min.js?v=3.3.6'); ?>"></script>
<script src="<?php echo staticResource('js/plugins/metisMenu/jquery.metisMenu.js'); ?>"></script>
<script src="<?php echo staticResource('js/plugins/slimscroll/jquery.slimscroll.min.js'); ?>"></script>
<script src="<?php echo staticResource('js/plugins/layer/layer.min.js'); ?>"></script>
<script src="<?php echo staticResource('extend/common.js'); ?>"></script>

<!-- 自定义js -->

<script type="text/javascript">
    // 切换验证码
    function getCaptcha() {
        $('#cap-img').attr('src',"<?php echo url('admin/captcha'); ?>" + '?a=' + Math.random());
    }

    // 提交
    function login() {
        let admin_name = $('#login_name').val();
        let password = $('#pwd').val();
        let captcha = $('#captcha').val();

        if(!admin_name) {
            layer.msg('请输入登录名', {icon: 5});
            return;
        }
        if(!password) {
            layer.msg('请输入登录密码', {icon: 5});
            return;
        }
        if(!captcha) {
            layer.msg('请输入验证码', {icon: 5});
            return;
        }
        //在这里执行表单提交
        $.ajax({
            url: "<?php echo url('admin/login'); ?>",
            type:'post',
            data:{
                admin_name,
                password,
                captcha,
            },
            success:function(res){
                if(res.code != 1){
                    layer.msg(res.msg, {icon: 5});
                }else{
                    layer.msg('登录成功', {icon: 1},function () {
                        location.replace("<?php echo url('admin/index'); ?>")
                    });
                }
            }
        })
    }
</script>



</body>

</html>
